In the existing standards for low bit rate aimed at image communication, such as H.261, H263, MPEG4, etc., motion vector detection is carried out for data compression using correlation between frames.
This motion vector detection is usually performed on a block (target block) comprising plural pixels in a current image (frame), and block matching is performed to check where the target block is positioned in a past image (frame) that is previous to the current image, thereby detecting a motion vector indicating the direction and amount of the motion of image.
FIG. 31 is a diagram for explaining the conventional motion vector detection. With reference to FIG. 31, a target block T is a block to be coded, comprising NX×NY pixels and included in a current image. A reference area is a search area comprising MX×MY pixels and included in a previous image, and this reference area is spatially in the vicinity of the target block T and is larger than the target block T. Further, a reference block I is a block comprising NX×NY pixels, placed in an arbitrary position in the reference area.
In general motion vector detection using block matching, the target block T is compared with plural reference blocks I in the reference area to obtain the position of a reference block I that is most matched with the target block T. Thereafter, the distance and direction between the position of the target block T and the position of the most-matching reference block I in the reference area, are detected as a motion vector. Matching between the target block T and the reference block I is carried out on the basis of the sum of absolute values of differences in pixel values between the target block T and the reference block I, as represented by the following formula (1).Σ|Ref(Mx+x,My+y)−Src(x,y)|  (1)wherein Ref (Mx+x,My+y) indicates the positions of pixels in the reference block, and Src(x,y) indicates the positions of pixels in the target block.
In order to detect a more accurate motion vector, the values of pixels positioned between pixel data in the reference area are obtained by interpolation, and matching with the target block is curried out with respect to the positions so obtained.
The calculation represented by formula (1) is the sum of absolute values of differences in pixel values between the NX×NY pixels constituting the target block and the NX×NY pixels constituting the reference block and, therefore, it requires enormous amounts of calculation to perform the same calculation on all of reference blocks in the reference area.
Usually, when the value of the sum of absolute differences in a search position is relatively large, this value may exceed the minimum value of the sum in the middle of the calculation Thereby, needless calculation is executed even though the position of this search area can be excluded from the candidates of search areas for motion vector detection, resulting in losses in calculation speed and power consumption.
Further, a motion vector hardly changes in the vicinity of a target block on which the motion vector is detected. However, even when an image of high resolution is not required especially, motion vector detection is carried out on the peripheral blocks, resulting in losses in calculation speed and power consumption.
In order to reduce the losses, whether there is a change or not may be checked using a versatile processor before performing calculation using a dedicated processor to decide whether search should be executed or not. In this case, however, a heavy load is put on the versatile processor.
In order to reduce the load on the versatile processor, the dedicated processor may have a function of calculating the sum of absolute difference only one time. In this case, however, if there is no change and therefore no search is required, operating the processor to obtain this result causes losses in calculation speed and power consumption.
Furthermore, when search for a reference block with respect to a target block is performed on reference blocks in the vicinity of the target block so as to minimize the sum of absolute differences in pixel values, there is a possibility that a once searched reference block may be searched again (double search), resulting in losses in calculation speed and power consumption.
Further, the sum of absolute differences is obtained by summing the absolute values of differences in pixel values between all pixels in a target block and all pixels in a reference block, even when an image of high resolution is not needed, calculation more than necessary is carried out, resulting in losses in calculation speed and power consumption.
In order to reduce the losses, subsampling may be performed, on every other line, on the pixels constituting the blocks, thereby reducing the amount of calculation. In this case, however, since pixel data to be used for motion vector detection become part of read-in pixel data, pixel data other than those to be used for motion vector detection, which have already been read, are undesirably discarded, resulting in a loss in power consumption.
Furthermore, when the target block is positioned at an edge of an effective region of pixel data, an area on which motion vector detection cannot be carried out is included in the reference area. Even when data are transferred to this area, the data are not used for detection, resulting in a loss in power consumption.
Furthermore, since there is an overlap between reference areas corresponding to adjacent target blocks, reading pixel data in the entire reference area into the dedicated processor at every search on each target block causes losses in computation speed and power consumption.
When the target block is positioned at an edge of the effective region of image data, some of image data in a reference area to be used for calculation are out of the effective region, depending on the position of the motion vector. In this case, motion vector detection cannot be carried out.
Furthermore, when performing interpolation to obtain the values of pixels positioned between pixels constituting a reference block, the pixel data constituting the reference block are read out in one direction. So, when the pixel data are read out in the horizontal direction, if the pixel values in positions between pixels in the vertical direction are desired, the processor should wait several cycles until the pixels required for interpolation in the vertical direction are prepared, resulting in a loss in the computation speed.